
import java.io.IOException;
import java.io.PrintWriter;
import java.sql.ResultSet;
import java.sql.Statement;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import sai.mysql.DriverLoading;

/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/**
 *
 * @author sai kumar
 */
public class HospAjax1 extends HttpServlet {
    
    Statement prepare,prepare1;
public void doGet(HttpServletRequest req,HttpServletResponse res)throws ServletException,IOException
{
    res.setContentType("text/html");
    PrintWriter  out1= res.getWriter();
    System.out.println("hello welcome");
    try
    {
   String user=req.getParameter("user");
   System.out.println(user);
   DriverLoading dl = new DriverLoading();
   prepare = dl.getStatement();
   ResultSet rs=prepare.executeQuery("select doctor_id from `doctor` where doctor_id='"+user+"'");  
   if(!rs.next())
   {
       out1.println("doctor id doesnt exist");
       System.out.println("false");
   }
   else
   {
       out1.println("exists");       
       System.out.println("true");
   }
    }
    catch(Exception e)
    {
        out1.println(e);
    } 
}
}
